var isPalindrome = function (s) {
  var a = s.toLocaleLowerCase().match(/[A-Za-z0-9]+/g).join('');
  let startIndex = 0;
  let endIndex = a.length - 1;
  while (startIndex < endIndex) {
    if (a[startIndex] === a[endIndex]) {
      startIndex++;
      endIndex--;
    } else {
      return false;
    }
  }
  return true;
};

console.log(isPalindrome("A man, a plan, a canal: Panama"));
